<template>
<div>
  <el-form :inline="true" :model="map" class="demo-form-inline">
    <el-form-item label="公司名称">
      <el-input v-model="map.name" placeholder="筛选关键字"></el-input>
    </el-form-item>
    <el-form-item label="店铺名称">
      <el-input v-model="map.nickName" placeholder="筛选关键字"></el-input>
    </el-form-item>
    <el-radio v-model="map.status" label="1">全部</el-radio>
    <el-radio v-model="map.status" label="2">待审核</el-radio>
    <el-radio v-model="map.status" label="3">已审核</el-radio>
    <el-radio v-model="map.status" label="4">审核未通过</el-radio>
    <el-radio v-model="map.status" label="5">关闭</el-radio>
    <el-form-item>
      <el-button type="success" @click="seach()">查询</el-button>
      <router-link to="/Add"  class="el-button el-button--primary" >添加</router-link>
    </el-form-item>
  </el-form>
  <template> <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="sellerId" label="商家ID" width="180"></el-table-column>
      <el-table-column prop="name" label="公司名称" width="180"></el-table-column>
      <el-table-column prop="nickName" label="店铺名称" width="180"></el-table-column>
      <el-table-column prop="linkmanName" label="联系人姓名" width="180"></el-table-column>
      <el-table-column prop="telephone" label="公司电话" width="180"></el-table-column>
      <el-table-column prop="status" label="状态" width="150">
      <template slot-scope="scope">
        <span v-if="scope.row.status==1">全部</span>
        <span v-if="scope.row.status==2">待审核</span>
        <span v-if="scope.row.status==3">已审核</span>
        <span v-if="scope.row.status==4">审核未通过</span>
        <span v-if="scope.row.status==5">关闭</span>
      </template>
    </el-table-column>

      </el-table>


  </template>
  <el-pagination
    @size-change="handleSizeChange"
    @current-change="handleCurrentChange"
    :current-page="page"
    :page-sizes="[5, 10, 15, 20]"
    :page-size="size"
    layout="total, sizes, prev, pager, next, jumper"
    :total="400">
  </el-pagination>
</div>
</template>
<script>
    export default {
        name: "AdminList",
      data(){
          return{
            tableData:[],
            map:{},
            total:0,
            page:1,
            size:3,
          }
      },methods:{
        seach(){
          this.findAll();
        },
        findAll(){
          this.$http.post("/shop/list/"+this.page+"/"+this.size,this.map).then((res)=>{
            /*debugger*/
            console.log(res);
            // alert(1)
            this.tableData=res.data.data.rows;
            this.total=Math.ceil(res.data.data.total/this.size);
          })
        },
        handleSizeChange(val) {
          this.size=val;
          this.seach();
        },
        handleCurrentChange(val) {
          this.page=val;
          this.findAll();
        },
      },mounted(){
        this.findAll();
      }
    }
</script>

<style scoped>

</style>
